package com.hsc.www.mybatis.soEasy.ee.crudMapper;


import com.hsc.www.mybatis.soEasy.ee.rr.Strategy;

import java.util.Arrays;
import java.util.List;

public interface InsertMapper<Entity> extends InsertBaseMapper<Entity> {


    default int insert(Entity entity) {
        return insert(entity, getDefaultStrategy());
    }
    
    default int insert(List<Entity> entityList) {
        return insert(entityList, getDefaultStrategy());
    }

    default int insert(Strategy strategy, Entity... entities) {
        if (entities == null || entities.length == 0) {
            return 0;
        } else if (entities.length == 1) {
            return insert(entities[0], strategy);
        } else {
            return insert(Arrays.asList(entities), strategy);
        }
    }

    default int insert(Entity... entities) {
        return insert(getDefaultStrategy(), entities);
    }

}
